package org.lsy.dao;

import org.lsy.pojo.AuthCode;
import org.springframework.data.jpa.repository.JpaRepository;

/**
 * @author SHIYUAN
 * @version 1.0
 */
public interface AuthCodeRepository extends JpaRepository<AuthCode, Integer> {

    /**
     * 根据邮箱和验证码按照过期时间倒排获取首个元素
     * @param code 验证码
     * @param email 电子邮箱
     * @return 实体类
     */
    AuthCode findFirstByCodeAndAndEmailOrderByExpiretimeDesc(String code, String email);
}
